#!/usr/bin/python
import os, re
p=os.popen('xdpyinfo -display :0.0 | grep dimensions')
line=p.readline()
p.close()
p=re.compile(r'\D*([0-9]+)x([0-9]+)\D*')
m=p.match(line)
if m!=None:
	width=int( m.group(1) )
	height=int( m.group(2) )
	f=open( os.path.expanduser('~/.wine/drive_c/war3res.reg'), 'w' )
	f.write(r'''REGEDIT4

	[HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Video]
	resheight=dword:%08x
	reswidth=dword:%08x
	'''%(height,width) )
	f.close()
	os.system('wine regedit ~/.wine/drive_c/war3res.reg')
